import unittest
from utils import HTMLTestRunner
from case.case01 import TEST01

if __name__ == '__main__':
    # unittest.main()
    # --------------------------
    # suite = unittest.TestSuite()
    # suite.addTest(TEST01('test_case01'))
    # unittest.TextTestRunner().run(suite)
    # --------------------------
    suite = unittest.TestSuite()
    discover = unittest.defaultTestLoader.discover(start_dir=r"./case", pattern="*.py",
                                                   top_level_dir=None)
    for cases in discover:
        for case in cases:
            suite.addTest(case)
    fp = open(r"./report/html_report.html", "wb")
    runner = HTMLTestRunner.HTMLTestRunner(stream=fp, title="标题", description="描述")
    runner.run(suite)
    fp.close()
